< previous page page_98 next page >

Page 98
The OptionButton_Click( ) Event
Lets write code in the Click() event for an option button that will enable the Save command button.
EXERCISE
Add Click( ) Events to Option Buttons
1. Double-click each of the option buttons in the form and add the following code:
Private Sub optMale_Click() ()
cmdSave.Enabled = True
End Sub

Private Sub optFemale_Click() ()
cmdSave.Enabled = True
End Sub
analysis.gifEach control on your form that changes the data will need to inform the user some data has changed. One common technique is to toggle the Enabled property of a command button.

Check Box Events
Check boxes are very much like option buttons. Youll normally respond only to the Click() event.
The CheckBox_Click( ) Event
Youll essentially write the same code in a check box Click() event that you write in the Click() event for an option button.
EXERCISE
Click( ) Events for Check Boxes
1. Double-click each of the check boxes in the form and add the following code to enable the Save button.
Private Sub chk401k_Click()
cmdSave.Enabled = True
End Sub

 
< previous page page_98 next page >

If you like this book, buy it!